package com.cn.designpatterns.ex.concrete.factory.abstarFacory;

import java.util.Objects;

/**
 * @author zhangyi
 * @date 2018/12/24 12:32
 */
public class FactoryProvider {

    public static AbstractFactory createFactory(int type){
        AbstractFactory abstractFactory = null;
        if(!Objects.isNull(type)){
            switch (type){
                case 1:
                    abstractFactory = new ShapeFactory();
                    break;
                case 2:
                    abstractFactory = new ColorFactory();
                    break;
                    default:
                        break;
            }
        }
        return abstractFactory;
    }
}
